#include "leos_def.h"

le_uint32_t le_find_first_set_bit(le_uint32_t value)
{
    return __builtin_ffs(value);
}

char *le_strncpy(char *dst, const char *src, le_uint32_t n)
{
    if (n != 0)
    {
        char *d = dst;
        const char *s = src;

        do
        {
            if ((*d++ = *s++) == 0)
            {
                /* NUL pad the remaining n-1 bytes */
                while (--n != 0)
                    *d++ = 0;
                break;
            }
        } while (--n != 0);
    }

    return (dst);
}

